package com.guozcc.bootweb.platform.common;

import com.alibaba.fastjson.JSONObject;

import java.util.concurrent.ConcurrentHashMap;


/**
 * 登录token缓存
 *      反馈说是不需要部署多台，那....
 *      就简单点？单机版？
 *      单例搞一下子算了
 */
public class LogionCache {
    //定义缓存集合
    private static volatile ConcurrentHashMap<String, ConcurrentHashMap<String, JSONObject>> tokenMap = null;

    //私有化构造函数
    private LogionCache(){}

    //公布获取方法
    public static ConcurrentHashMap<String, ConcurrentHashMap<String, JSONObject>> getInstance(){
        if(tokenMap==null){
            synchronized(LogionCache.class){
                if(tokenMap==null){
                    tokenMap = new ConcurrentHashMap<String, ConcurrentHashMap<String, JSONObject>>();
                }
            }
        }
        return tokenMap;
    }
}
